package com.pl.activemq;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

/**
 * Topic消息消费者
 *
 * @author shent
 */
@Service
public class TopicConsumer {

    /**
     * 接收订阅消息1
     *
     * @param msg
     */
    @JmsListener(destination = ActiveMqConfig.TOPIC_NAME, containerFactory = "topicListenerContainer")
    public void receiveTopicMsg1(String msg) {
        System.out.println("收到的消息1为：" + msg);
    }

    /**
     * 接收订阅消息2
     *
     * @param msg
     */
    @JmsListener(destination = ActiveMqConfig.TOPIC_NAME, containerFactory = "topicListenerContainer")
    public void receiveTopicMsg2(String msg) {
        System.out.println("收到的消息2为：" + msg);
    }
}